Repository navigation
fix(hosted): personal-view delete and attachment remove/rename answer on a hosted tenant kernel instead of 404 - #36690
Conversation
…a kernel with no http.server (WIP) Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JQwxbXs1Hrj1qNTkGdJbK1
…ments (WIP) Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JQwxbXs1Hrj1qNTkGdJbK1
…nal-view and attachment doors Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JQwxbXs1Hrj1qNTkGdJbK1
…endency, and the unmatched-door pin typechecks The personal-view member imports plugin-hono-server, so it moves from devDependencies to dependencies. The storage hosted pin reads the 404 envelope through toMatchObject. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JQwxbXs1Hrj1qNTkGdJbK1
📓 Docs Drift CheckThis PR changes 6 package(s): 18 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 7 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 185 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin f8ae870606a22694409b39de5a7be58910ec2ec3 && git checkout f8ae870606a22694409b39de5a7be58910ec2ec3
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin c1e6cf75a757a7e9102bae608ddb020135619882 8163e388bfd40b203f04433aa8038a680d64b03b && git checkout -B drift-repro c1e6cf75a757a7e9102bae608ddb020135619882 && git merge --no-ff 8163e388bfd40b203f04433aa8038a680d64b03b
node scripts/docs-audit/affected-docs.mjs --json c1e6cf75a757a7e9102bae608ddb020135619882
|
|
repo:objectstack#1 · os-warren · session_01JQwxbZeHNsF3RWcWpj7rGj Contract reviewServed-tier: ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgment
Implemented-by: VERDICT: FAIL |
…s on the hosted shape createHonoApp over a kernel with no http.server, the real AuthPlugin composed with registerRoutes: false, the real StorageServicePlugin, security and sharing, and real better-auth sessions: the owner removes their own personal view and renames then removes their own attachment (200 each, store follows), another member and anonymous are refused, the refusals are byte-identical to the self-hosted mount, and a kernel without service-storage answers 501. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JQwxbXs1Hrj1qNTkGdJbK1
…ts, security and sharing from source Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JQwxbXs1Hrj1qNTkGdJbK1
|
repo:objectstack#1 · os-warren · session_01JQwxbZeHNsF3RWcWpj7rGj Contract reviewServed-tier: ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgment
Implemented-by: VERDICT: PASS |
|
repo:objectstack#1 · os-warren · session_01JQwxbZeHNsF3RWcWpj7rGj 维护者速读云端(托管)环境里,「删除自己保存的个人视图」以及附件的「删除、改名」点了以后会报找不到接口。这次修好了,和自建环境的行为、权限完全一致:本人能操作;别人删不了;没登录的人会被拒绝。 席位核对 — ACCEPT (L1) · repo:objectstack#1 · head
|
Requested by Warren · project thread
Fixes #36506
Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
What changes
Root cause:
DELETE /api/v1/personal-views/:id(plugin-auth) andDELETE/PATCH /api/v1/attachments/:id(service-storage) were mounted only on the kernel'shttp.server. A hosted tenant kernel owns no socket, registers nohttp.server, and runsAuthPluginwithregisterRoutes: false. The host'screateHonoAppcatch-all hands every unclaimed/api/v1/*request toHttpDispatcher.dispatch(), which had no domain for either prefix and answered404 ROUTE_NOT_FOUND. The cloud host's storage bridge covers only/api/v1/storage, so it never reached them either.The fix applies ruling A on #22438 to these two members of the class, the same shape #36539 gave the comment doors:
IPersonalViewDoorsService.handlePersonalViewDoor(request): Promise<Response>types a newpersonal-viewsslot.IAttachmentDoorsService.handleAttachmentDooris implemented by the existingfile-attachmentsservice besideIFileAttachmentService. Both members are optional.createDoorTableMember(routes, mount)(new export of@objectstack/plugin-hono-server) runs the plugin's own registrar on a privateHonoHttpServerthat never listens, built on first request. So the caller resolution, every refusal and every answer are the self-hosted mount's own bytes. The self-hosted mounts are unchanged and no path is mounted twice.AuthPlugin.init()registerspersonal-viewswhateverregisterRoutessays;mountPersonalViewDoorand the member share onepersonalViewDoorDeps().StorageServicePluginhandsFileAttachmentServiceanattachmentDoorsmember overmountAttachmentRemovalDoor.domains/own-door-bridge.ts) and two domains,/personal-viewsand/attachments, claim exactly the door shapes and forward the transport's request, body unread and re-addressed to the wire path, to the member on the REQUEST kernel's slot (getRequestKernelService, never the host's scoped fallback). Any other shape under those prefixes keeps404 ROUTE_NOT_FOUND. No slot, or no member: a typed501 NOT_IMPLEMENTEDnaming the package that registers it. A member throw or a consumed body: a sanitised500, logged. No auth-gate or membership exemption is added, so on the dispatcher the doors are stricter than the self-hosted mount, never looser.server-onlyrows inroute-ledger.ts(census 153 → 156); a newown-row-doors-sessionrow in the authz conformance matrix;check-route-envelope.mjsaudits the three new domain files.@objectstack/plugin-authand@objectstack/service-storagenow depend on@objectstack/plugin-hono-serverat runtime (no manifest cycle;check:workspace-manifest-cyclesgreen).Clause-②: yes): two new contract interfaces, a new typed slot name (personal-viewsis now taken, so a composition registering its own service under that name besideAuthPluginfails to boot with a duplicate-service error), two new exports from plugin-hono-server, and two new dispatcher domains.No cloud code change and no cloud deploy is needed. Hosted gets the fix when cloud's objectstack pin moves past this PR, as with #36469.
Tests
packages/runtime/src/domains/own-door-bridge.test.ts(27):describe.eachover both families. Forwarding with the transport's own request and body unread; exact claim and misses; the environment-scoped spelling; 501 for an empty slot, a throwing lookup and a missing member; per-request reads; request kernel only (the host kernel's member is never used); member throw 500; consumed body 500; both preamble gates (membership 403, owed-step gate) with a member control.packages/plugins/plugin-hono-server/src/door-table-member.test.ts(4): byte parity against aHonoHttpServermount; unmatched 404 without building the table; built once; the matcher.packages/plugins/plugin-auth/src/personal-view-door-member.test.ts(3):AuthPlugin.initwithregisterRoutes: falseregisters the slot once; an anonymous request is byte-equal to the self-hosted mount's 401; a non-door request is 404ENDPOINT_NOT_FOUND.packages/services/service-storage/src/attachment-removal-routes.integration.test.ts: a new describe with nohttp.server(no routes mounted; the uploader renames then removes, 200 each; another member 403; anonymous 401 on both doors; a GET 404).packages/qa/http-conformance/src/hono-own-row-doors.conformance.test.ts(7), the wire half:createHonoAppover a kernel with nohttp.server, the realAuthPlugincomposed withregisterRoutes: false, the realStorageServicePlugin, platform objects, security and sharing, and real better-auth sessions signed in through the same transport. No door answers a route miss; the owner removes their own personal view (200, row gone); another member 404RECORD_NOT_FOUNDand anonymous 401 (row stays); the uploader renames then removes their own attachment (200 each, store follows); anonymous 401 on both attachment doors; the refusals are byte-identical to the self-hosted mount over a real socket; a kernel without service-storage answers 501 naming it. The subject packages resolve from source (vitest.config.tsaliases).HttpDispatcheralone (hosted-dispatcher.testkit.ts):personal-view-row-scopegains a[hosted]describe (owner removal 200, another user 404RECORD_NOT_FOUND, anonymous 401);member-attachment-baselinegains a[hosted]case (other member 403, anonymous 401, rename 200 trimmed, removal 200 and the row is gone).Acceptance notes
scripts/ablation-replace.mjswith the restore proved (blob == HEAD,git diff HEADempty):http-dispatcher.ts:own-door-bridge.test.ts21 of 27 red (the 6 that stay green are the miss and gate cases, which hold without the domain);ctx.registerService('personal-views', …)deleted: the plugin-auth member test 3 of 3 red;attachmentDoors:dep renamed away: the storage integration file 3 red, 17 green (the new describe's door cases).distrebuilt: 7 of 7 red, each answering the pre-fix404 ROUTE_NOT_FOUND(restored, rebuilt, green again);registerService('personal-views', …)deleted: 4 red (every personal-view case and the parity case);attachmentDoors:renamed away: 4 red (every attachment case and the parity case).#36311conflicts inauth-plugin.ts, butorigin/main × #36311already has that one hunk (an import line).HEAD × #36311has the same single hunk, so it is not added by this branch.#35129and#34223merge cleanly.Verification
personal-view-row-scope+member-attachment-baseline37 / 37.dispatch-gates --ran: 137 derived, 136 run green, 1 NOT MEASURED (check:dual-build-cjs-loads, exit 3, needs every package'sdist/; left to CI).check:undeclared-dep-importscaught plugin-auth listing plugin-hono-server as a dev dependency only; fixed and green.--no-inline-configaspnpm lintruns it, green (the whole-treepnpm lintis left to CI);check-nul-bytesOK.Gate reconciliation
Human Minimum
packages/specholds no runtime logic.pnpm lintpasses.main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.https://claude.ai/code/session_01JQwxbXs1Hrj1qNTkGdJbK1
Generated by Claude Code